<template>
<el-row style="background-color: #A29B95;height:100%;">
  <el-col :span="16">
      <div class="demo-image__placeholder">
        <div class="block">
            
            <el-image src="https://z1.muscache.cn/im/pictures/1fc5c7f0-73ce-45ef-8777-6e686e1a6363.jpg" style="padding-top:50px;padding-left:50px;height:600px;width:100%;"></el-image>
        </div>
      </div>
  </el-col>
  <el-col :span="8">
      <div class="wrap" id="wrap">
        <div class="logGet">
            <!-- 头部提示信息 -->
            <div class="logD logDtip">
                <p class="p1">登录</p>
            </div>
            <!-- 输入框 -->
            <div class="lgD">
                <img src="http://bpic.588ku.com/art_origin_min_pic/19/03/14/9de51e363f425dc85a1b7ba45889f5f7.jpg" width="20" height="20" alt="" />
                <input type="text" placeholder="输入用户名" v-model="ruser.uname" />
            </div>
            <div class="lgD">
                <img src="http://bpic.588ku.com/element_origin_min_pic/19/04/22/cf824832a8e23dfeac211694d3f58742.jpg" width="20" height="20" alt="" />
                <input type="password" placeholder="输入用户密码" v-model="ruser.upassword"/>
            </div>

            
            <div class="logC">
                <a><button @click="loginFn">登 录</button></a>
            </div>
            <!-- {{cityName}} -->
        </div>
    </div>
  </el-col>
</el-row>
    
</template>

<script>
import {login} from '../../api'
    export default {
        data() {
            return {
                src: 'https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg',
                ruser : {
                    uname : '',
                    upassword : ''
                },
                cityName : 'shanghai',
            }
        },
        created (){
           
        },
        // watch: {
        //     // cityName(newName, oldName) {
        //     //     // alert('1')
        //     //     // window.location.reload()
        //     //     // alert(this.ruser.uname)  
        //     //     // if(this.ruser.uname != '' || this.ruser.uname != undefined){
        //     //     //     window.location.reload()
        //     //     //     this.$router.push('/')
        //     //     // }
        //     // }
        // } ,
        methods: {
            async loginFn() {
　　　　　　　　　let { data:baseRefault} = await login(this.ruser)
                if(baseRefault.code == 1){
                    this.$message.success(baseRefault.message)
                    this.$router.push('/')
                    try {
                        sessionStorage.setItem('userid',baseRefault.data.uid)
                        
                        window.location.reload()
                    } catch (error) {
                        
                    }finally{
                        this.cityName = 'beijing'
                    }
                }else{
                    this.$message.error(baseRefault.message)
                }


                 
            }
        }
    }
</script>

<style>
    /* body {
        background-image: url(../../assets/logo.jpg);
        background-size: 100%;
        background-repeat: no-repeat;
        background-position: center center;
    } */

    * {
        margin: 0;
        padding: 0;
    }

    #wrap {
        height: 600px;
        width: 100%;
        background-position: center center;
        position: relative;
        
    }

    #head {
        height: 120px;
        width: 100;
        background-color: #66CCCC;
        text-align: center;
        position: relative;
    }

    #wrap .logGet {
        height: 408px;
        width: 368px;
        position: absolute;
        background-color: #FFFFFF;
        top: 100px;
        right: 15%;
    }

    .logC a button {
        width: 100%;
        height: 45px;
        background-color: #FFCC00;
        border: none;
        color: white;
        font-size: 18px;
    }

    .logGet .logD.logDtip .p1 {
        display: inline-block;
        font-size: 28px;
        margin-top: 30px;
        width: 86%;
    }

    #wrap .logGet .logD.logDtip {
        width: 86%;
        border-bottom: 1px solid #ee7700;
        margin-bottom: 60px;
        margin-top: 0px;
        margin-right: auto;
        margin-left: auto;
    }

    .logGet .lgD img {
        position: absolute;
        top: 12px;
        left: 8px;
    }

    .logGet .lgD input {
        width: 100%;
        height: 42px;
        text-indent: 2.5rem;
    }

    #wrap .logGet .lgD {
        width: 86%;
        position: relative;
        margin-bottom: 30px;
        margin-top: 30px;
        margin-right: auto;
        margin-left: auto;
    }

    #wrap .logGet .logC {
        width: 86%;
        margin-top: 0px;
        margin-right: auto;
        margin-bottom: 0px;
        margin-left: auto;
    }


    .title {
        font-family: "宋体";
        color: #FFFFFF;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        /* 使用css3的transform来实现 */
        font-size: 36px;
        height: 40px;
        width: 30%;
    }

    .copyright {
        font-family: "宋体";
        color: #FFFFFF;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        /* 使用css3的transform来实现 */
        height: 60px;
        width: 40%;
        text-align: center;
    }
    
</style>